package com.yuanqunsoft.alimigration.service.impl;

import java.util.List;

import com.yuanqunsoft.alimigration.dao.IReportWithRulesetDao;
import com.yuanqunsoft.alimigration.model.ReportWithRuleset;
import com.yuanqunsoft.alimigration.service.IReportWithRulesetService;

public class ReportWithRulesetServiceImpl implements IReportWithRulesetService{

    private IReportWithRulesetDao reportWithRulesetDao;
    
    public IReportWithRulesetDao getReportWithRulesetDao() {
        return reportWithRulesetDao;
    }

    public void setReportWithRulesetDao(IReportWithRulesetDao reportWithRulesetDao) {
        this.reportWithRulesetDao = reportWithRulesetDao;
    }

    @Override
    public ReportWithRuleset findById(Integer id) {
        return this.reportWithRulesetDao.findById(id);
    }

    @Override
    public List<?> findByReportId(Integer repId) {
        return this.reportWithRulesetDao.findByReportId(repId);
    }

    @Override
    public boolean deleteByReportId(Integer repId) {
        try{
            this.reportWithRulesetDao.deleteByReportId(repId);
            return true;
        }catch(RuntimeException re){
            return false;
        }
    }

    @Override
    public boolean deleteReportWithRuleset(ReportWithRuleset instance) {
        try{
            this.reportWithRulesetDao.delete(instance);
            return true;
        }catch(RuntimeException re){
            return false;
        }
    }

    @Override
    public boolean addReportWithRuleset(ReportWithRuleset instance) {
        try{
            this.reportWithRulesetDao.save(instance);
            return true;
        }catch(RuntimeException re){
            return false;
        }
    }

}
